package xyz.lwm.lazycat.annotation;

import xyz.lwm.lazycat.utility.reflect.AliasTo;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * setting 对象前缀设置
 *
 * @author lwm
 */
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE, ElementType.METHOD})
public @interface SettingPrefix {

    /**
     * setting prefix
     *
     * <pre>{@code
     * # yml
     * lazy:
     *   ds:
     *     username: root
     *     password: root
     *
     * // setting bean
     * @SettingPrefix("lazy.ds")
     * public class LazyDsSetting {
     *     private String username;
     *     private String password;
     * }
     *
     * // get bean form setting using prefix
     * LazyDsSetting setting = Setting.get().forPath(LazyDsSetting.class);
     * }</pre>
     */
    @AliasTo("prefix")
    String value() default "";

    @AliasTo("value")
    String prefix() default "";

}
